package com.ionehe.group.common.file.configure;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.HashMap;
import java.util.Map;

/**
 * Copyright (c) 2021 ionehe.com
 * Date: 2021/4/25
 * Time: 11:04 上午
 *
 * @author 2021年 <a href="mailto:a@ionehe.com">秀</a>
 * 【文件服务端配置】
 */
@ConfigurationProperties(prefix = "file", ignoreInvalidFields = true)
@Data
public class FileServerConfiguration {
    private FileVendors vendor;
    private Map<FileVendors, Map> vendors = new HashMap<>(0);

    @Override
    protected FileServerConfiguration clone() throws CloneNotSupportedException {
        FileServerConfiguration configuration = new FileServerConfiguration();
        configuration.setVendor(this.vendor);
        Map<FileVendors, Map> map = new HashMap<>((FileVendors.values()).length);
        if (null != this.vendors) {
            for (FileVendors k : this.vendors.keySet()) {
                map.put(k, new HashMap<>(this.vendors.get(k)));
            }
        }
        configuration.setVendors(map);
        return configuration;
    }
}
